﻿using System;
using System.Collections.Generic;
using System.Text;

using Elegant.Ui;

namespace iPdf
{
    class HoverSelectionTextBox: Elegant.Ui.TextBox
    {
        public HoverSelectionTextBox():
            base()
        {
            this.MouseHover += new EventHandler(HoverSelectionTextBox_MouseHover);
            this.MouseLeave += new EventHandler(HoverSelectionTextBox_MouseLeave);
        }

        private void HoverSelectionTextBox_MouseHover(object sender, EventArgs e)
        {
            if (this.Enabled && !string.IsNullOrEmpty(this.Text))
            {
                //select the text
                this.SelectAll();
            }
        }

        private void HoverSelectionTextBox_MouseLeave(object sender, EventArgs e)
        {
            //disselect the text
            this.Select(0, 0);
        }
    }
}
